#include <bits/time.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>

timer_t tid;
void fn(union sigval val)
{
	struct itimerspec *itsp = val.sival_ptr;
	printf("time exec %ld\n", itsp->it_value.tv_sec);
}

int main()
{
	struct timespec tp;
	clock_gettime(CLOCK_BOOTTIME, &tp);
	printf("elapsed =%ld %ld\n", tp.tv_sec, tp.tv_nsec);

	clock_gettime(CLOCK_MONOTONIC, &tp);
	printf("monot =%ld %ld\n", tp.tv_sec, tp.tv_nsec);

	printf("%s\n", ctime(&tp.tv_sec));

	struct tm tm;
	gmtime_r(&tp.tv_sec, &tm);
	int pass = 60 * 60 * tm.tm_hour + 60 * tm.tm_min + tm.tm_sec;
	printf("%s\n", ctime(&tp.tv_sec));

	tp.tv_sec = 5;
	clock_nanosleep(CLOCK_BOOTTIME, 0, &tp, NULL);

	return 0;
}